#include <stdio.h>
void print(int x)
{
    if (x > 9)
    {
        print(x / 10);
    }
    printf("%d ", x % 10);
}

int main()
{

    int x = 0;
    int i = 0;
    scanf("%d", &x);
    print(x);
    printf("\n");
    while (x > 0)
    {
        printf("%d ", x % 10);
        x = x / 10;
        i++;
    }
    printf("\n%d", i);

    return 0;
}
